package com.zkx.laolaiyi.config;

import com.zkx.laolaiyi.properties.PrivateKeyProperties;
import com.zkx.laolaiyi.utils.EncryptUtil;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.crypto.SecretKey;

@Configuration
@RequiredArgsConstructor
//@ConfigurationProperties(prefix = "laolaiyi.private-key")
@Data
public class JwtConfig {
//    private String passwordEncryptKey;
    private final PrivateKeyProperties privateKeyProperties;
    @Bean
    public SecretKey secretKey() {
        return EncryptUtil.createSecretKey(privateKeyProperties.getPasswordEncryptKey());
    }
}
